/**
 * 修改moduleTask列表
 */

export const types = {
    SET_INFO: 'mine/SET_INFO',
    LOGIN: 'mine/LOGIN_USER',
    LOGOUT: 'mine/LOGOUT',
}

const state = {
    loggedIn : false,
    info: null
}

// actions
const actions = {};
actions[types.SET_INFO] = function({ commit, state }, info) {
    commit(types.SET_INFO, info);
};
actions[types.LOGIN] = function({ commit, state }) {
    commit(types.LOGIN);
};
actions[types.LOGOUT] = function({ commit, state }) {
    commit(types.LOGOUT);
};

// mutations
const mutations = {
    [types.SET_INFO] (state, info) {
        state.info = info;
    },
    [types.LOGIN] (state) {
        state.loggedIn = true;
    },
    [types.LOGOUT] (state) {
        state.loggedIn = false;
    },
}

export default {
    state,
    actions,
    mutations
}
